﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using GraphCompiler.Core;

namespace GraphCompiler.Specification
{
    [TestFixture]
    public class TokenSpecs
    {
        [Test]
        public void SetsTokenStringWhenCreatedWithString()
        {
            var token = new Token("token string");

            Assert.AreEqual("token string", token.String);
        }

        [Test]
        public void ConsidersTokenEqualToItself()
        {
            var token = new Token("");

            Assert.AreEqual(token, token);
        }

        [Test]
        public void ConsidersTokenEqualToOtherTokenWithSameString()
        {
            var token1 = new Token("");
            var token2 = new Token("");

            Assert.AreEqual(token1, token2);
        }

        [Test]
        public void DoesNotConsiderTokenEqualToTokenWithDifferentString()
        {
            var token1 = new Token("");
            var token2 = new Token("string");

            Assert.AreNotEqual(token1, token2);
        }

        [Test]
        public void UsesTokenStringAsTextualRepresentation()
        {
            var token = new Token("token string");

            Assert.AreEqual("token string", token.ToString());
        }
    }
}
